/**
 * Created by huangchao on 14/11/2017.
 */
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import style from './style.less'
import {Icon} from 'antd'

class ConnentTop extends Component {
  static propTypes = {
    name: PropTypes.string,
  }

  state = {
    loding: false,
  }

  onRfersh = () => {
    this.setState({
      loding: true,
    })
    setTimeout(() => {
      window.location.reload()
    }, 200)
  }

  render() {
    // console.log(this.props)
    return (
      <div className={style.ConnentTopWrap}>
        <div className={style.body}>
          <div className={style.left}>
            {this.props.name || '系统首页'}
          </div>
          <div onClick={this.onRfersh} className={style.right}>
            <Icon type="sync" spin={this.state.loding} className={style.icon} />
            刷新
          </div>
        </div>
      </div>
    )
  }
}

export default ConnentTop
